package com.jkt.rms.business.base;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

import com.jkt.rms.business.Authorities;
import com.jkt.rms.business.SystemRole;


/**
 * This is an object that contains data related to the users table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="users"
 */
public abstract class BaseUsers  implements Serializable {

	private static final long serialVersionUID = 1L;
	public static String PROP_ENABLED = "Enabled";
	public static String PROP_EMAIL = "Email";
	public static String PROP_USERNAME = "Username";
	public static String PROP_PASSWORD = "Password";
	public static String PROPUPDATEDDATE = "updatedDate";
	public static String PROPUPDATEDBY = "updatedBy";
	public static String PROPENABLED = "enabled";
	public static String PROP_FIRSTNAME = "firstName";
	public static String PROP_LASTNAME = "lastName";
	public static String PROP_SYSTEMROLE = "sysRoleObj";

	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private String username;

	// fields
	private String email;
	private String password;
	private String firstName;
	private String lastName;
	private String updatedBy;
	private Timestamp updatedDate;
	private char enabled;
	private SystemRole sysRoleObj;
	private List<Authorities> listAuthorities;

	// constructors
	public BaseUsers () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseUsers (String username) {
		this.setUsername(username);
		initialize();
	}

	/**
	 * Constructor for required fields
	 */
	public BaseUsers (
		String username,
		String password,
		String email,
		String firstName,
		String lastName,
		String updatedBy,
		Timestamp updatedDate,
		char enabled,
		List<Authorities> listAuthorities) {

		this.setUsername(username);
		this.setPassword(password);
		this.setEmail(email);
		this.setFirstName(firstName);
		this.setLastName(lastName);
		this.setUpdatedBy(updatedBy);
		this.setUpdatedDate(updatedDate);
		this.setEnabled(enabled);
		this.setListAuthorities(listAuthorities);
		initialize();
	}

	protected void initialize () {}

	public String getUsername () {
		return username;
	}

	public void setUsername (String username) {
		this.username = username;
		this.hashCode = Integer.MIN_VALUE;
	}


	public char getEnabled () {
		return enabled;
	}

	public void setEnabled (char enabled) {
		this.enabled = enabled;
	}


	public String getEmail () {
		return email;
	}

	public void setEmail (String email) {
		this.email = email;
	}


	public String getPassword () {
		return password;
	}
	public void setPassword (String password) {
		this.password = password;
	}


	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof com.jkt.rms.business.base.BaseUsers)) return false;
		else {
			com.jkt.rms.business.base.BaseUsers mObj = (com.jkt.rms.business.base.BaseUsers) obj;
			if (null == this.getUsername() || null == mObj.getUsername()) return false;
			else return (this.getUsername().equals(mObj.getUsername()));
		}
	}


	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getUsername()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getUsername().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}


	public String toString () {
		return super.toString();
	}

	public SystemRole getSysRoleObj() {
		return sysRoleObj;
	}

	public void setSysRoleObj(SystemRole sysRoleObj) {
		this.sysRoleObj = sysRoleObj;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getUpdatedBy() {
		return updatedBy;
	}

	public void setUpdatedBy(String updatedBy) {
		this.updatedBy = updatedBy;
	}

	public Timestamp getUpdatedDate() {
		return updatedDate;
	}

	public void setUpdatedDate(Timestamp updatedDate) {
		this.updatedDate = updatedDate;
	}

	
	public List<Authorities> getListAuthorities() {
		return listAuthorities;
	}

	public void setListAuthorities(List<Authorities> listAuthorities) {
		this.listAuthorities = listAuthorities;
	}

}